From: Jasper St. Pierre Date: Mon, 14 Oct 2013 01:51:30 +0000 (-0400) Subject: messageTray: Only connect to a notification's open/destroy once X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~3206 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=99cf4e578714beefddd542573fa9658f6d3b9299;p=gnome-shell.git messageTray: Only connect to a notification's open/destroy once If we pushNotification the same notification multiple times, we won't append it to the array again, but we will attach multiple handlers needlessly. https://bugzilla.gnome.org/show_bug.cgi?id=710115 --- diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 65ab89be1..9dfb54cec 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -1407,10 +1407,8 @@ const Source = new Lang.Class({ }, pushNotification: function(notification) { - if (this.notifications.indexOf(notification) < 0) { - this.notifications.push(notification); - this.emit('notification-added', notification); - } + if (this.notifications.indexOf(notification) >= 0) + return; notification.connect('clicked', Lang.bind(this, this.open)); notification.connect('destroy', Lang.bind(this, @@ -1426,6 +1424,9 @@ const Source = new Lang.Class({ this.countUpdated(); })); + this.notifications.push(notification); + this.emit('notification-added', notification); + this.countUpdated(); },